package com.查找算法;

import java.util.HashMap;

class Solution7 {
    public char firstUniqChar(String s) {
        HashMap<Character, Boolean> dic = new HashMap<>();
        char[] sc = s.toCharArray();
        for (char c:sc) {
            if(!dic.containsKey(c)){
                dic.put(c,true);
            }
            else dic.replace(c,false);
        }
        for (char c:sc) {
            if(dic.get(c)==true) return c;
        }
        return ' ';
    }
}

public class 剑指Offer50第一个只出现一次的字符 {
    public static void main(String[] args) {

    }
}
